import { createRouter, createWebHistory } from "vue-router";
import managerLayout from "@/layout/managerLayout.vue";
import userLayout from "@/layout/userLayout.vue";

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/views/userLogin"),
  },
  {
    path: "/manager",
    name: "managerLayout",
    component: managerLayout,
    children: [
      {
        path: "userManage",
        name: "userManage",
        component: () => import("@/views/userManage"),
      },
      {
        path: "requestManage",
        name: "requestManage",
        component: () => import("@/views/requestManage"),
      },
      {
        path: "allDockerManage",
        name: "allDockerManage",
        component: () => import("@/views/allDockerManage"),
      },
    ],
  },
  {
    path: "/user",
    name: "userLayout",
    component: userLayout,
    children: [
      {
        path: "userDockerManage",
        name: "userDockerManage",
        component: () => import("@/views/userDockerManage"),
      },
      {
        path: "userRequest",
        name: "userRequest",
        component: () => import("@/views/userRequest"),
      },
      {
        path: "openDocker",
        name: "openDocker",
        component: () => import("@/views/openDocker"),
      },
    ],

  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
